package com.itheima.health.config;

import com.itheima.health.interceptor.LoginMemberlnterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
@Slf4j
public class WebMvcConfig implements WebMvcConfigurer {

    @Resource
    private LoginMemberlnterceptor loginUserInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        log.info("开始注册自定义拦截器...");
        registry.addInterceptor(loginUserInterceptor)
                .addPathPatterns("/admin/**")//拦截路径,以admin为例
                //登录，发验证码
                .excludePathPatterns("/member/login.do","/validatecode/send4Login.do");

    }
}
